$(function ()
{
    findMsg();
});

function findMsg()
{
    let data = fontAjax('/home', {}, 'get');

    let model = data.model;
    let productTypeList = data.productTypeList;
    let newList = data.newList;
    let hotel = data.hotel;
    let products = data.products;

    let productCade = '';
    let productBlock = '';
    let productImg = '';
    let news = '';
    if (model != null)
    {
        $('#bigTitle').html('<a href="/html/projectServer.html">' + model.bigTitle + '</a>');
        $('#smallTitle').html(model.smallTitle);
        $('#aboutHotel').html(model.hotelMsg);
        $('#contentTop').html(model.contentTop);
        $('#contentMid').html(model.contentMid);
        $('#contentBottom').html(model.contentBottom);
    }
    if (hotel != null)
    {
        $('#rephone').html(hotel.reservationPhone);
    }
    if (productTypeList != null)
    {
        for (let i = 0; i < productTypeList.length; i++)
        {
            if (i < 3 && productTypeList[i] != null)
            {
                productCade += '<div>\n' +
                    '                            <div class="mid-sec-two-top">\n' +
                    '                                <div class="mid-sec-two-top-color">' + productTypeList[i].productType + '</div>\n' +
                    '                                <div class="mid-sec-two-bottom-color">' + productTypeList[i].enType + '</div>\n' +
                    '                            </div>\n' +
                    '                            <div class="mid-sec-two-bottom">\n' +
                    '                                <div></div>\n' +
                    '                                <div><a href="/html/projectServer.html" target="_blank">MORE DETAILS</a></div>\n' +
                    '                            </div>\n' +
                    '                        </div>';
            }
            if (i < 5 && productTypeList[i] != null)
            {
                productBlock += '<div><a href="/html/projectServer.html">' + productTypeList[i].productType + '</a></div>';
            }
        }

        for (let i = 0; i < products.length; i++)
        {
            if (products[i] != null)
            {
                productImg += '<img src="' + products[i].img + '" height="232" width="300"/>';
            }
        }

        for (let i = 0; i < newList.length; i++)
        {
            if (i < 3)
            {
                news += '<div>\n' +
                    '                            <div><a href="/html/details.html">' + newList[i].title + '</a></div>\n' +
                    '                            <div>' + newList[i].updateTime + '</div>\n' +
                    '                        </div>';
            }
        }
    }
    $('#productCade').html(productCade);
    $('#productBlock').html(productBlock);
    $('#productImg').html(productImg);
    $('#newList').html(news);
}